import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ImageInfo } from "../../../../../com/gengine/resource/info/ImageInfo";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { LoaderManager } from "../../../../../com/gengine/resource/LoaderManager";
type int = number;
//class CareerChangeItem
    
    export  class CareerChangeItem /* flash.display.Sprite */
    {
        constructor(arg1: Boolean=true)
        {
            
            this._current = arg1;
            this.initUI();
            return;
        }

        /* internal  */onCareerResLoaded(): void
        {
            if (this._current) 
            {
                this._bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.careerBg2);
                this._font.bitmapData = GlobalClass.getBitmapData(ImagesConst.careerChangeBegin);
            }
            else 
            {
                this._bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.careerBg1);
                this._font.bitmapData = GlobalClass.getBitmapData(ImagesConst.careerChangeEnd);
            }
            this._font.x = (this.width - this._font.width) / 2;
            return;
        }

        /* internal  */onCareerBaseIconLoaded(arg1: ImageInfo): void
        {
            if (arg1 && arg1.bitmapData) 
            {
                this._careerName.bitmapData = arg1.bitmapData;
                this._careerName.x = (this.width - this._careerName.width) / 2;
            }
            return;
        }

        protected initUI(): void
        {
            this._bg = new Object /* flash.display.Bitmap */();
            addChild(this._bg);
            this._font = new Object /* flash.display.Bitmap */();
            this._font.y = 20;
            addChild(this._font);
            this._careerName = new Object /* flash.display.Bitmap */();
            this._careerName.y = 50;
            addChild(this._careerName);
            LoaderHelp.addResCallBack(ResFileConst.careerChange, this.onCareerResLoaded);
            return;
        }

        public updateCareer(arg1: int): void
        {
            this._careerId = arg1;
            LoaderManager.instance.load("careerChange_" + this._careerId + ".png", this.onCareerBaseIconLoaded);
            return;
        }

        public /* override */ get width(): number
        {
            return 123;
        }

        public /* override */ get height(): number
        {
            return 129;
        }

        /* internal */ /* var */_bg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_font: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_careerName: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_careerId: int;

        /* internal */ /* var */_current: Boolean;
    }
